package Response

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
)

func Response(context *gin.Context, httpStatus int, code int, data gin.H, msg string) {
	fmt.Println("here")
	context.JSON(httpStatus, gin.H{"msg": msg,
		"data": data,
		"code": code})

}

//成功
func Success(context *gin.Context, data gin.H, msg string) {
	Response(context, 200, 200, data, msg)
}

//失败
func Fail(ctx *gin.Context, msg string, data gin.H) {
	Response(ctx, http.StatusOK, 400, data, msg)
}

func MessageMaker(msg string) gin.H {
	return gin.H{"msg": msg}
}
